#!/bin/bash

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`    
echo "SDK设置为1.8"

mvn clean install -DskipTests=true
echo "打包"

cp target/yilan-chat-server-app.jar deploy/yilan-chat-server-app.jar
echo "复制jar包到docker文件目录去"

cd deploy && docker build --platform linux/amd64 -t yilan-chat-server .
echo "定位目录并且打成docker镜像"

docker save -o yilan-chat-server.tar.gz yilan-chat-server
# 启动docker yilan-chat-server 容器
# docker run -d -p 8012:8012 --name yilan-chat-server --restart=always yilan-chat-server
#启动nacos容器
# docker run -d -p 8848:8848 -p 9848:9848 --name nacos --restart=always -e MODE=standalone -e PREFER_HOST_MODE=hostname nacos/nacos-server:latest